package com.example.hrsystem.data.source;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import androidx.room.Delete;

import com.example.hrsystem.workflow.model.ProcessDefinition;

import java.util.List;

@Dao
public interface ProcessDefinitionDao {
    @Query("SELECT * FROM process_definitions")
    List<ProcessDefinition> getAllProcessDefinitions();

    @Query("SELECT * FROM process_definitions WHERE id = :id")
    ProcessDefinition getProcessDefinitionById(int id);

    @Query("SELECT * FROM process_definitions WHERE processKey = :processKey")
    ProcessDefinition getProcessDefinitionByKey(String processKey);

    @Insert
    void insertProcessDefinition(ProcessDefinition processDefinition);

    @Update
    void updateProcessDefinition(ProcessDefinition processDefinition);

    @Delete
    void deleteProcessDefinition(ProcessDefinition processDefinition);

    @Query("DELETE FROM process_definitions")
    void deleteAllProcessDefinitions();
}